package com.ruoyi.web.controller.dispatch;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.DispatchMultiPeriodAnalysisRecords;
import com.ruoyi.system.service.IDispatchMultiPeriodAnalysisRecordsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 多时段分析记录Controller
 * 
 * @author ruoyi
 * @date 2025-03-02
 */
@RestController
@RequestMapping("/system/dispatchMultiPeriodAnalysisRecords")
public class DispatchMultiPeriodAnalysisRecordsController extends BaseController
{
    @Autowired
    private IDispatchMultiPeriodAnalysisRecordsService dispatchMultiPeriodAnalysisRecordsService;

    /**
     * 查询多时段分析记录列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchMultiPeriodAnalysisRecords:list')")
    @GetMapping("/list")
    public TableDataInfo list(DispatchMultiPeriodAnalysisRecords dispatchMultiPeriodAnalysisRecords)
    {
        startPage();
        List<DispatchMultiPeriodAnalysisRecords> list = dispatchMultiPeriodAnalysisRecordsService.selectDispatchMultiPeriodAnalysisRecordsList(dispatchMultiPeriodAnalysisRecords);
        return getDataTable(list);
    }

    /**
     * 导出多时段分析记录列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchMultiPeriodAnalysisRecords:export')")
    @Log(title = "多时段分析记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DispatchMultiPeriodAnalysisRecords dispatchMultiPeriodAnalysisRecords)
    {
        List<DispatchMultiPeriodAnalysisRecords> list = dispatchMultiPeriodAnalysisRecordsService.selectDispatchMultiPeriodAnalysisRecordsList(dispatchMultiPeriodAnalysisRecords);
        ExcelUtil<DispatchMultiPeriodAnalysisRecords> util = new ExcelUtil<DispatchMultiPeriodAnalysisRecords>(DispatchMultiPeriodAnalysisRecords.class);
        util.exportExcel(response, list, "多时段分析记录数据");
    }

    /**
     * 获取多时段分析记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchMultiPeriodAnalysisRecords:query')")
    @GetMapping(value = "/{multiPeriodAnalysisRecordsId}")
    public AjaxResult getInfo(@PathVariable("multiPeriodAnalysisRecordsId") Long multiPeriodAnalysisRecordsId)
    {
        return success(dispatchMultiPeriodAnalysisRecordsService.selectDispatchMultiPeriodAnalysisRecordsByMultiPeriodAnalysisRecordsId(multiPeriodAnalysisRecordsId));
    }

    /**
     * 新增多时段分析记录
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchMultiPeriodAnalysisRecords:add')")
    @Log(title = "多时段分析记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DispatchMultiPeriodAnalysisRecords dispatchMultiPeriodAnalysisRecords)
    {
        return toAjax(dispatchMultiPeriodAnalysisRecordsService.insertDispatchMultiPeriodAnalysisRecords(dispatchMultiPeriodAnalysisRecords));
    }

    /**
     * 修改多时段分析记录
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchMultiPeriodAnalysisRecords:edit')")
    @Log(title = "多时段分析记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DispatchMultiPeriodAnalysisRecords dispatchMultiPeriodAnalysisRecords)
    {
        return toAjax(dispatchMultiPeriodAnalysisRecordsService.updateDispatchMultiPeriodAnalysisRecords(dispatchMultiPeriodAnalysisRecords));
    }

    /**
     * 删除多时段分析记录
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchMultiPeriodAnalysisRecords:remove')")
    @Log(title = "多时段分析记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{multiPeriodAnalysisRecordsIds}")
    public AjaxResult remove(@PathVariable Long[] multiPeriodAnalysisRecordsIds)
    {
        return toAjax(dispatchMultiPeriodAnalysisRecordsService.deleteDispatchMultiPeriodAnalysisRecordsByMultiPeriodAnalysisRecordsIds(multiPeriodAnalysisRecordsIds));
    }
}
